package cn.nexd.app.collector.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import cn.nexd.app.collector.fragment.CollectFileFragment;
import cn.nexd.app.collector.fragment.ErrorFileFragment;

/**
 * Created by xunzongxia on 16/10/9.
 */

public class FileManagerAdapter extends FragmentPagerAdapter {
    private String[] titles;

    public FileManagerAdapter(FragmentManager fm, String[] titles) {
        super(fm);
        this.titles = titles;
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 0) {
            return CollectFileFragment.newInstance(position);
        } else if (position == 1) {
            return ErrorFileFragment.newInstance(position);
        } else {
            return null;
        }
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }


}
